Repository navigation
feat: list repositories and cd to one by name - #13
simonostendorf wants to merge 6 commits into
Conversation
|
Verdict: changes requested Reviewed at the pushed head, commits bdbe80b..f93d885. Acceptance criteria from issue #3, checked one by one against the real binary, not just the diff:
Boundary probe (built a real tree under
Ranking attack probes (built a second tree: a repository named
No break found in matching or ranking. The claim in the pull request description holds under all four probes. Exit codes measured directly, not just asserted in tests:
Terminal detection limitation: confirmed directly. Tests, revert-and-fail, in a detached copy of the source tree only (never the worktree, since its
All three reverts were restored before moving on; the scratch copy was deleted. Isolation: ran every probe with Blocker
Should
|
A .git entry is a repository boundary whether it is a directory or a file, which is what a linked worktree leaves behind, so one rule covers both and .claude/worktrees with it. Refs #3
An exact name wins outright over any broader match, so a repository is never shadowed by a longer path that happens to contain the query. An ambiguous query opens a numbered picker on a terminal and exits non zero listing the candidates anywhere else, because the shell function reads the exit code. Refs #3
Completion shells out to list on every tab rather than caching, so a repository cloned a moment ago completes immediately. Refs #3
The boundary rule stopped the walk at a repository, so a worktree under <repo>/.claude/worktrees/<branch> was never seen. That is the layout this organisation mandates, so the common shape was the one that did not work. Each repository is now asked for its own worktrees through git, which is authoritative and costs one subprocess per repository rather than a deeper walk. A nested independent repository is still not reported. Refs #3
A character device test cannot tell /dev/null from a terminal, so the message no longer claims a certainty it does not have. Refs #3
f93d885 to
6231a1f
Compare
What
internal/scanwalksrootinto repositories, reusingprofile.Inspectrather thanduplicating remote and worktree handling.
cmd/gitcdgainslistwith--jsonand--worktrees, andcdwith matching and a picker.internal/shellwrapscdin all three shells and adds completion for zsh and fish.Why
.gitentry is a repository boundary whether it is a directory or a file. A linked worktreeleaves a file, so one rule covers both linked worktrees and
.claude/worktreesinstead of twospecial cases. Probed against a real linked worktree before the code was written.
root, and an exact name winsoutright over any broader match. Predictable beats clever here, because this runs inside a
shell function the user cannot see into.
liston every tab rather than caching, so a repository cloned amoment ago completes immediately.
Inspectcannot resolve is reported with its error rather than silently dropped.Verification
task checkexit 0.two repositories both named
widget:cdand forlist, 1 for no match and for an ambiguous query without a terminal.Risk
real isatty needs a dependency this repository does not carry. A pipe or a redirected file is
detected correctly, which is the case that matters.
/dev/nulland/dev/zeroare themselvescharacter devices, so they are misread as a terminal: the command then fails safely with
"no selection was read" and exit 1, but for the wrong stated reason.
cdconsiders linked worktrees as candidates whilelisthides them by default. That isdeliberate, since jumping into a worktree is the point, but the two commands do disagree about
what they show.
internal/scanlands here and feat: status, sync and open across repositories #5 needs the same walk. It was told to build the minimum itneeds separately rather than wait, so the two need reconciling once both are in.
Closes #3
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.